package mushystuff.dtb.ws.to;

import java.util.Collection;
import java.util.Iterator;

import mushystuff.dtb.core.model.UserStory;
import mushystuff.dtb.core.model.UserStory.Estimate;

public class UserStoryTransferObject {
	
	private UserStory userStory;
	
	public UserStoryTransferObject(UserStory userStory) {
		this.userStory = userStory;
	}
	
	public long getId() {
		return userStory.getId();
	}

	public String getStory() {
		return userStory.getStory();
	}
	
	public String getEstimate() {
		return userStory.getEstimate().toString();
	}
	
	public static UserStoryTransferObject[] toArray(Collection<UserStory> userStories) {
		UserStoryTransferObject[] res = new UserStoryTransferObject[userStories.size()];
		Iterator<UserStory> userStoriesIterator = userStories.iterator();
		for(int i=0;i<userStories.size();i++) {
			res[i] = new UserStoryTransferObject(userStoriesIterator.next());
		}
		return res;
	}
}
